package com.imooc.feeds.util;

import java.util.Date;

import com.imooc.commons.exception.ParameterException;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;

/**
 * \* @author: bear
 * \* Date: 2021-08-05-17:49
 * \* describe:
 */
public class DateUtils {

	public static Date getDate(String dateStr) {
		if (StrUtil.isBlank(dateStr)) {
			return new Date();
		}
		try {
			return DateUtil.parse(dateStr);
		} catch (Exception e) {
			throw new ParameterException("请传入yyyy-MM-dd的日期格式");
		}
	}
}
